package com.aauedu.springboot.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
public class MonsterController {

    //等价的写法
//    @RequestMapping(value = "/monster", method = RequestMethod.GET)
    @GetMapping("/monster")
    public String getMonster() {
        return "GET-查询妖怪";
    }

    //等价的写法
//    @RequestMapping(value = "/monster", method = RequestMethod.PUT)
    @PutMapping("/monster")
    public String putMonster() {
        return "PUT-修改妖怪";
    }

    //等价的写法
//    @RequestMapping(value = "/monster", method = RequestMethod.POST)
    @PostMapping("/monster")
    public String saveMonster() {
        return "POST-添加妖怪";
    }

    //等价的写法
//    @RequestMapping(value = "/monster", method = RequestMethod.DELETE)
    @DeleteMapping("/monster")
    public String deleteMonster() {
        return "DELETE-删除妖怪";
    }

    @RequestMapping("/go")
    public String go() {
        return "hello";  // 顺序  1 先看 controller 有没有/hello [没有配置视图解析器]  2 如果没有就到视图解析器,就按照视图解析器来定位页面
    }


}
